<?php 
session_start();
require_once "../lib/DBClass.php";

$user = $_POST ['usr'];
$pass = $_POST ['pwd'];

if('submit'){
	$Q = mysql_query("select username, pass from admin WHERE username='".$user."' AND pass = '".$pass."'");
	$r = mysql_fetch_array($Q);

	if (mysql_num_rows($Q)){

		$_SESSION['user']=$r['username'];
		$_SESSION['pass']=$r['pass'];

		header('location:index.php');

	} else {

		header('location:index.php');
	}
}
 ?>